﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using DataAccess.ArchivesTableAdapters;
using DataAccess;
using System.Data;

namespace BusinessLogic
{
    [DataObject]
    public class PositionBO
    {
        private tblPositionTableAdapter PositionAdapter = null;
        protected tblPositionTableAdapter Adapter
        {
            get
            {
                if (PositionAdapter == null)
                    PositionAdapter = new tblPositionTableAdapter();
                return PositionAdapter;
            }
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
        public Archives.tblPositionDataTable GetAllPositions()
        {
            return Adapter.GetAllPositions();
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public DataTable GetByID(int pID)
        {
            return Adapter.GetByID(pID);
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Insert, true)]
        public int AddNewPosition(string pName, string pCode)
        {
            return Adapter.AddNewPosition(pName, pCode);
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Update, true)]
        public int UpdatePosition(string pName, string pCode, int pID)
        {
            return Adapter.UpdatePosition(pName, pCode, pID);
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Delete, true)]
        public int DeletePosition(int pID)
        {
            return Adapter.Delete(pID);
        }
    }
}
